/*          FILE: token.h
 *      Language: C
 *        Author: <Qiwei Feng> <Pufan He> <Yichao Zhou>
 *       Created: 2012-02-26
 * Last Modified: 2012-03-01
 *   Description:
 *       License: GNU GPL v3
 */

#ifndef __C_H_TOKEN
#define __C_H_TOKEN

#include "symbol-table.h"
#include "operator.h"
#include "keyword.h"

typedef enum {
        TOKEN_END = 0,
        TOKEN_SPACE,
        TOKEN_VARTYPE,
        TOKEN_IDENTITY,
        TOKEN_CONST,
        TOKEN_BINARY_OPERATOR,
        TOKEN_ASSIGNMENT_OPERATOR,
        TOKEN_PARENTHESES,
        TOKEN_SEMICOLON,
        TOKEN_KEYWORD
} token_type_e;

typedef struct token_t {
        unsigned row_index;
        unsigned col_index;
        token_type_e token_type;
        token_t *next;
} token_t;

typedef struct {
        token_t father;
} token_end_t;

typedef struct {
        token_t father;
} token_space_t;

typedef struct {
        token_t father;
        // here we only have an "int"
} token_vartype_t;

typedef struct {
        token_t father;
        symbol_entry_t *entry;
} token_identity_t;

typedef struct {
        token_t father;
        int value;
} token_const_t;

typedef struct {
        token_t father;
        binary_operator_type_e binary_operator_type;
} token_binary_operator_t;

typedef struct {
        token_t father;
} token_assignment_operator_t;

typedef struct {
        token_t father;
        parentheses_type_e parentheses_type;
} token_parentheses_t;

typedef struct {
        token_t father;
} token_semicolon_t;

typedef struct {
        token_t father;
        keyword_type_e keyword_type;
} token_keyword_t;

#endif

/* vim: set syn=c ts=8 sts=8 sw=8 tw=79 ff=unix et : */
